package com.mer.controller;

import com.mer.sevice.SpecialService;
import com.mer.vo.CommonResult;
import com.mer.vo.SpecialVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: SpecialController
 * @description: 专区
 * @author: 吴昊
 * @create: 2021/10/19 8:47
 **/
@RestController
@RequestMapping("home/special")
public class SpecialController {
    @Resource
    private SpecialService specialService;

    @ApiOperation("分页查询")
    @PostMapping("getAllSpecial/{page}/{limit}")
    public CommonResult getAllSpecial(@PathVariable Integer page, @PathVariable Integer limit, @RequestBody SpecialVo specialVo){
        return specialService.getAllSpecial(page, limit, specialVo);
    }
    @ApiOperation("修改状态")
    @PostMapping("status/{id}/{isDisable}")
    public CommonResult exchange(@PathVariable String id,@PathVariable Integer isDisable){
        return specialService.exchange(id, isDisable);
    }
    @ApiOperation("新增和修改")
    @PostMapping("add")
    public CommonResult add(@RequestBody SpecialVo specialVo){

        return specialService.add(specialVo);
    }
    @ApiOperation("删除")
    @PostMapping("delete")
    public CommonResult delete(@RequestBody SpecialVo specialVo){
        return specialService.delete(specialVo);
    }

}
